package org.example;

import redis.clients.jedis.Jedis;

public class JedisContectTest {
    public static void main(String[] args) {
        //先new一个jedis的对象
        Jedis jedis=new Jedis("127.0.0.1",6379);
        //jedis所用的命令就是之前学习的所有指令
        System.out.println(jedis.ping());//查看连接
        //操作命令
        System.out.println("清空所有值 "+jedis.flushAll());
        System.out.println("新增string "+jedis.set("k1","v1"));
        System.out.println("判断k1是否存在 "+jedis.exists("k1"));
        System.out.println("拿到k1的值 "+jedis.get("k1"));
        System.out.println("查看k1的type "+jedis.type("k1"));
        System.out.println("删除k1的值 "+jedis.del("k1"));
        System.out.println("判断k1是否存在 "+jedis.exists("k1"));
        System.out.println("清空所有值 "+jedis.flushAll());
    }
}
